package com.yonyou.pmclouds.pmpub.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.yonyou.pmclouds.basecom.entity.AdditionalPropertiesVOWrapper;
import com.yonyou.pmclouds.basecom.entity.SuperVO;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.ArrayUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class PMListQueryResult implements Serializable {
    private AdditionalPropertiesVOWrapper[] busiVOs;
    private Integer totalNum;
    private int pageStart;
    private int pageSize;
    private String firstQueryDate;

    @JsonIgnore
    public SuperVO[] getBuziSuperVOs(){

        if(ArrayUtils.isEmpty(busiVOs))
            return new SuperVO[0];

        List<SuperVO> voList = new ArrayList<>();
        for(AdditionalPropertiesVOWrapper wrapperVO : busiVOs){
            voList.add((SuperVO) wrapperVO.getWrapped());
        }
        return voList.toArray(new SuperVO[0]);
    }

}

